home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
user
/
cup_viewteamprogress.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
15KB
|
432 lines
/* Mode=Set */
/* ***********************************************************************
VIEW TEAM PROGRESS PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 181297 First release.
140998 Added support for Two-Leg matches and Away Goals.
210499 Added check for no team specified.
250899 Added error msg to file checks.
110999 Converted to use locale. Some error messages, before
reading the locale, will still be in English.
**************************************************************************
Procedure
---------
1. Check files exist.
2. Read '.cf' file and get cup name and team list.
3. Search for selected team and give error if cannot find it, else set
marker.
4. Read '.scf' file and read in all round names and matches that the
selected team was in.
5. Display title.
6. Loop. Get roundname and change if replay. Get Home and Away type.
7. Read match and get opponent and score, adding it to goals conceeded
and goals scored.
8. Check next line for Extra Time, and append to score string. Change
goals_con/scored accordingly.
9. Check next line for Penalties, and append to score string.
10.Display round, home/away, opponent and score.
11.End loop.
12.Exit.
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.cf'
input2_file = '.scf'
separator = '*'
matches. = '???'
mcount = 0
not_played = '__ __'
teams. = '???'
counter = 0
title = '*CUP_TITLE='
awaygs = '*CUP_AWAYG='
parse var league_stuff league_file search_team
league_file = "Data/" || league_file
if open(datafile,"Data/Football.locale",'r') then do
line = readln(datafile)
locdir = strip(line)
close(datafile)
end
else do
say
say "ERROR : (ViewTeamProgress)"
say
say "Cannot read 'Data/Football.locale' for the locale settings."
exit
end
dcupdir = locdir"Football.locale_cup"
locdir = locdir"User/Cup_ViewTeamProgress.data"
if open(datafile,"ENV:FootballRXPath",'r') then do
line = readln(datafile)
rxdir = strip(line)
close(datafile)
end
else
rxdir = "SYS:Rexxc/"
if exists(locdir) > 0 then do
address command rxdir'rx 'locdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (ViewTeamProgress)"
say
say "Cannot find '"locdir"' to read locale settings."
exit
end
if exists(dcupdir) > 0 then do
address command rxdir'rx 'dcupdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (ViewTeamProgress)"
say
say "Cannot find '"dcupdir"' to read cup locale settings."
exit
end
if exists(league_file || input_file) = 0 then do
say
say cvtp_error
say
say cvtp_t1"'"league_file || input_file"'."
exit
end
if exists(league_file || input2_file) = 0 then do
say
say cvtp_error
say
say cvtp_t1"'"league_file || input2_file"'."
exit
end
if search_team = "" then do
say
say cvtp_error
say
say cvtp_t3
say
say cvtp_t4
say
exit
end
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then cupname= delstr(line,1,11)
if pos(awaygs,line) > 0 then awayg = delstr(line,1,11)
if pos(separator,line) = 0 then do
line = strip(line)
if counter = 0 then do
teams.1 = line
counter = 1
end
else do
counter = counter + 1
teams.counter = line
end
end
end
close(datafile)
end
else do
say
say cvtp_error
say
say cvtp_t2"'"league_file||input_file"'"cvtp_t5
exit
end
sel=-1
search_team = strip(search_team)
do i=1 to counter
if pos(search_team,teams.i) > 0 then
sel = i
end
if sel < 0 then do
say
say cvtp_error
say
say cvtp_t8" '"search_team"'"cvtp_t9
exit
end
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos("*Round",line) > 0 then do
mcount = mcount + 1
matches.mcount = line
end
if pos(separator,line) = 0 & pos("#",line) = 0 then do
line = strip(line)
if pos(teams.sel,line) > 0 then do
mcount = mcount + 1
matches.mcount = line
mkr = 1
end
else
mkr = 0
end
if pos("#",line) > 0 & mkr = 1 then do
mcount = mcount + 1
matches.mcount = line
end
end
close(datafile)
end
else do
say
say cvtp_error
say
say cvtp_t2"'"league_file||input2_file"'"cvtp_t5
exit
end
say
say center("'"cupname"'",78)
say "-------------------------------------------------------------------------------"
say
say cvtp_t10" : "teams.sel
say
say
say cvtp_t11
say cvtp_t12
say
goals_con = 0
goals_scr = 0
donem = 0
do i=1 to mcount
if pos("*Round",matches.i) > 0 then do
if pos("Replay",matches.i) > 0 then
round = left(cs_t31,15,' ')
else do
parse var matches.i "*Round="name
round = substr(name,1,5)
if pos("1 Leg",name) > 0 then round = round" "cvtp_t14
if pos("2 Legs",name) > 0 then round = round" "cvtp_t15
round = left(round,15,' ')
end
donem = 0
h = 0
j = i + 1
if pos(teams.sel,matches.j) = 1 then do
round = round||cvtp_t16
h = 1
donem = 1
end
if pos(teams.sel,matches.j) > 1 then do
round = round||cvtp_t17
h = 2
donem = 1
end
if donem = 1 then do
if pos(not_played,matches.j) > 0 then do
if h = 1 then opponent = strip(substr(matches.j,41,30))
if h = 2 then opponent = strip(substr(matches.j,1,30))
say round""left(opponent,32)" - "cvtp_t18
end
else do
sd = ''
if pos("2 Legs",name) > 0 then do
for = strip(substr(matches.j,32,2))
aga = strip(substr(matches.j,37,2))
if h = 1 then do
sd = right(for,2)""cvtp_t19""left(aga,2)
goals_scr = goals_scr + for
goals_con = goals_con + aga
opponent = strip(substr(matches.j,41,30))
end
else do
sd = right(aga,2)""cvtp_t19""left(for,2)
goals_scr = goals_scr + aga
goals_con = goals_con + for
opponent = strip(substr(matches.j,1,30))
end
k = j + 1
if pos("#1st Leg",matches.k) > 0 then do
parse var matches.k "#1st Leg" for1l aga1l .
for1l = strip(for1l)
aga1l = strip(aga1l)
if h = 1 then
sd = sd" "cvtp_t20": "right(for1l+for,2)""cvtp_t19""left(aga1l+aga,2)
else
sd = sd" "cvtp_t20": "right(aga1l+aga,2)""cvtp_t19""left(for1l+for,2)
if (for1l+for) = (aga + aga1l) then do
if pos("YES",awayg) > 0 then do
if for1l > aga then do
if h = 1 then
extra_line = " "strip(teams.sel)" "cvtp_t21
else
extra_line = " "opponent" "cvtp_t21
np = 1
end
if for1l < aga then do
if h = 1 then
extra_line = " "opponent" "cvtp_t21
else
extra_line = " "strip(teams.sel)" "cvtp_t21
np = 1
end
end
end
end
k = k + 1
if pos("#Score After Extra Time",matches.k) > 0 then do
for1 = strip(substr(matches.k,32,2))
aga1 = strip(substr(matches.k,37,2))
if h = 1 then do
sd = sd". "cvtp_t22": "right(for1,2)""cvtp_t19""left(aga1,2)" "cvtp_t20": "right(for1l+for1,2)""cvtp_t19""left(aga1l+aga1,2)
goals_scr = goals_scr - for + for1
goals_con = goals_con - aga + aga1
end
else do
sd = sd". "cvtp_t22": "right(aga1,2)""cvtp_t19""left(for1,2)" "cvtp_t20": "right(aga1l+aga1,2)""cvtp_t19""left(for1l+for1,2)
goals_scr = goals_scr - aga + aga1
goals_con = goals_con - for + for1
end
if (for1+for1l) = (aga1 + aga1l) then do
if pos("YES",awayg) > 0 then do
if for1 > aga then do
if h = 1 then
extra_line = " "strip(teams.sel)" "cvtp_t21
else
extra_line = " "opponent" "cvtp_t21
extra_line2= " "cvtp_t23
np = 2
end
if for1 < aga then do
if h = 1 then
extra_line = " "opponent" "cvtp_t21
else
extra_line = " "strip(teams.sel)" "cvtp_t21
extra_line2= " "cvtp_t23
np = 2
end
end
end
k = k + 1
if pos("#Penalties",matches.k) > 0 then do
for1 = strip(substr(matches.k,32,2))
aga1 = strip(substr(matches.k,37,2))
sd = sd||","
if h = 1 then
extra_line3 = " "cvtp_t24": "right(for1,2)""cvtp_t19""left(aga1,2)
else
extra_line3 = " "cvtp_t24": "right(aga1,2)""cvtp_t19""left(for1,2)
np = 3
end
end
else do
if pos("#Penalties",matches.k) > 0 then do
for1 = strip(substr(matches.k,32,2))
aga1 = strip(substr(matches.k,37,2))
if h = 1 then
sd = sd" "cvtp_t24": "right(for1,2)""cvtp_t19""left(aga1,2)
else
sd = sd" "cvtp_t24": "right(aga1,2)""cvtp_t19""left(for1,2)
end
end
end
if pos("2 Legs",name) = 0 then do
for = strip(substr(matches.j,32,2))
aga = strip(substr(matches.j,37,2))
if h = 1 then do
sd = right(for,2)""cvtp_t19""left(aga,2)
goals_scr = goals_scr + for
goals_con = goals_con + aga
opponent = strip(substr(matches.j,41,30))
end
else do
sd = right(aga,2)""cvtp_t19""left(for,2)
goals_scr = goals_scr + aga
goals_con = goals_con + for
opponent = strip(substr(matches.j,1,30))
end
g = j + 1
if pos("#Score After Extra Time",matches.g) > 0 then do
for1 = strip(substr(matches.g,32,2))
aga1 = strip(substr(matches.g,37,2))
if h = 1 then do
sd = sd" "cvtp_t22": "right(for1,2)""cvtp_t19""left(aga1,2)
goals_scr = goals_scr - for + for1
goals_con = goals_con - aga + aga1
end
else do
sd = sd" "cvtp_t22": "right(aga1,2)""cvtp_t19""left(for1,2)
goals_scr = goals_scr - aga + aga1
goals_con = goals_con - for + for1
end
g = g + 1
if pos("#Penalties",matches.g) > 0 then do
for1 = strip(substr(matches.g,32,2))
aga1 = strip(substr(matches.g,37,2))
if h = 1 then
sd = sd" "cvtp_t24": "right(for1,2)""cvtp_t19""left(aga1,2)
else
sd = sd" "cvtp_t24": "right(aga1,2)""cvtp_t19""left(for1,2)
end
end
else do
if pos("#Penalties",matches.g) > 0 then do
for1 = strip(substr(matches.g,32,2))
aga1 = strip(substr(matches.g,37,2))
if h = 1 then
sd = sd" "cvtp_t24": "right(for1,2)""cvtp_t19""left(aga1,2)
else
sd = sd" "cvtp_t24": "right(aga1,2)""cvtp_t19""left(for1,2)
end
end
end
say round""left(opponent,32)" "sd
if np > 0 then do
if np = 3 then say extra_line3
if np = 1 | np = 2 then say extra_line
if np = 2 then say extra_line2
np = 0
end
donem = 0
end
end
end
end
say
say
say
say left(cvtp_t25,20," ")": "goals_scr
say left(cvtp_t26,20," ")": "goals_con
say
say
say "-------------------------------------------------------------------------------"
exit
/*************************************************************************************/